package com.mike.employment.base.config;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mike.employment.base.ApiResult;
import com.mike.employment.base.exception.BusinessExcep;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@ControllerAdvice
@ResponseBody
public class GlobalExcepHandler {
	 /**
     * 处理自定义的业务异常
     */
    @ExceptionHandler(value = BusinessExcep.class)
    public ApiResult bizExceptionHandler(BusinessExcep e) {
        log.error("发生业务异常！ msg: -> ", e);
        return ApiResult.eror(444, e.getMessage());
    }
}
